<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Admin
 *
 * @author hoangle
 */
class Service_Account {
    //put your code here

    /**
     * @desc Check login
     * @param <int> $flag 1: frontend; 2: backend
     */
    public function checkLogin($flag) {
        if($flag == 1) {
            $sessionInfo = new Zend_Session_Namespace('User');
            if(!empty($sessionInfo->accountinfo)) {
            }
            else {
                header('Location: /login');
                exit;
            }
        }
        else {
            $sessionInfo = new Zend_Session_Namespace('Admin');
            if(!empty($sessionInfo->admininfo)) {
            }
            else {
                header('Location: /backend/login');
                exit;
            }
        }
    }


}
?>
